<template>
	<view class="paySuccessful">
	  <image src="/static/successful.png"></image>
	  <view class="amount">订单支付成功</view>
	  <view class="btnBox">
	    <button class="btn order" @click="goOrder">查看订单</button>
	    <button class="btn back" @click="goIndex">返回商品</button>
	  </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				return_goods:0,
				goods_id:0			}
		},
		onLoad(opt) {
			if(opt.return_goods){
				this.return_goods = opt.return_goods;
			}
			if(opt.goods_id){
				this.goods_id = opt.goods_id;
			}
			if(opt.token){
				uni.setStorageSync("xixuan_pintuan_token",opt.token);
			}
		},
		methods: {
			goIndex () {
				if(this.goods_id){
					// #ifdef APP-PLUS
					uni.navigateBack({
						delta:1
					});
					// #endif
					// #ifdef H5
					window.top.location.href = window.location.protocol+"//"+window.location.host+"/pages/index/goodsDetails?goods_id="+this.goods_id;
					// #endif
				}else{
					uni.navigateBack({
						delta:1
					});
				}
				// uni.switchTab({
				// 		url: '/pages/index/index'
				// 	});	
				// }
			},
			goOrder () {
				if(this.goods_id){
					// #ifdef APP-PLUS
					uni.switchTab({
						url: '/pages/my/my'
					});
					// #endif
					// #ifdef H5
					window.top.location.href = window.location.protocol+"//"+window.location.host+"/pages/my/my";
					// #endif
				}else{
					uni.switchTab({
						url: '/pages/my/my'
					})
				}
				
			}
		}
	}
</script>

<style scoped>
.paySuccessful {
  min-height: 100%;
  background-color: var(--bgColor);
}
.paySuccessful image {
  width: 327rpx;
  height: 335rpx;
  display: block;
  margin: 0 auto;
  padding-top: 110rpx;
}
.paySuccessful .amount {
  margin-top: 60rpx;
  font-size: 32rpx;
  text-align: center;
}
.btnBox {
  margin-top: 196rpx;
  display: flex;
  justify-content: center;
}
.btnBox .btn {
  width: auto;
  margin: 0 20rpx;
  font-size: 28rpx;
  font-weight: 500;
  padding: 12rpx 92rpx;
  font-size: 28rpx;
}
.btnBox .btn.order {
  background-color: var(--primaryColor);
  color: #fff;
}
.btnBox .btn.back {
  color: #b5b5b5;
  background-color: #ffffff;
  border: 1rpx solid #b5b5b5;
}
</style>
